function[] = QC_alpha(data,T,Ts,Tt,stderr)
%%%% Computes quick&dirty estimate of alpha in a chosen interval ([0,d1], [d1-T-d2], or [T-d2,T])
%%%% based on two values T-s and T-t within this interval. The program gives an estimate and a 
%%%% standard error based on bootstrap.
%%%% INPUT ARGUMENTS
%%%% data = vector of all bid times
%%%% T = length of auctions (in seven day auctions, enter 7)
%%%% Ts, Tt = two values that are most likely within the interval of interest
%%%% stderr = flag for whether bootstrap stanadard deviation is computed.
%%%% Default is yes. Chose value other than 1 to supress this.

if nargin < 5,
    stderr = 1;
end

t = T - Tt;
s = T - Ts;

alpha = QC_a(data,T,s,t)

if stderr == 1,
    M=500; %%% Sets number of bootstrap samples
    bt_data = bootrsp(data,M);

    for j=1:M, 
        if QC_a(bt_data(:,j)',T,s,t) < Inf,
            alpha(j) = QC_a(bt_data(:,j)',T,s,t); 
        end
    end
    std_alpha = std(alpha)/sqrt(M)
end

function[alpha] = QC_a(data,T,s,t)
alpha = 2*( log( Empirical_CDF(data,T-t)-Empirical_CDF(data,T-sqrt(s*t)) ) - ...
    log( Empirical_CDF(data,T-sqrt(s*t))-Empirical_CDF(data,T-s) ) ) / ( log(t/s) );